<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /***
         *  //         0 1 2 3 4
         *  var arr = [1,2,3,4,5];
         * 
         *  var index = 2;
         *  ===> [1,2,4,5];
         * 
         *  // arr[2] = arr[3]    [1,2,4,4,5]
         *  // arr[3] = arr[4]    [1,2,4,5,5]
         * 
         *  arr.length--          [1,2,4,5]
         * 
         */

        var arr = [1,2,3,4,5];
        var index = 1;
        for(var i = index; i < arr.length; i++){
            arr[i] = arr[i + 1];
        }
        arr.length--;
        console.log(arr);

        
    </script>
</body>
</html>